package com.Android.Intr;

import java.util.List;

import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;

public class MyMapView extends MapActivity {
	@Override
	protected boolean isRouteDisplayed() {
	    return false;
	}
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.mappage);
	    final MapActivity thisMap = this;
	    MapView mapView = (MapView) findViewById(R.id.mapview);
	    MapController mc = mapView.getController();
	    mapView.setBuiltInZoomControls(true);
	    
	    final Intent mapIntent = getIntent();
	    final String latString = mapIntent.getStringExtra("lat");
	    final String lonString = mapIntent.getStringExtra("lon");
	    final String location = mapIntent.getStringExtra("location");
	    final String title = mapIntent.getStringExtra("title");
	    final String date = mapIntent.getStringExtra("date");
	    final String time = mapIntent.getStringExtra("time");
	    final String detail = mapIntent.getStringExtra("detail");
	    
	   
	    
	    int lat = (int)(Float.valueOf(latString).floatValue())*1000000;
	    int lon = (int)(Float.valueOf(lonString).floatValue())*1000000;
	    
	    List<Overlay> mapOverlays = mapView.getOverlays();
	    Drawable drawable = this.getResources().getDrawable(R.drawable.marker);
	    MyItemizedOverlay itemizedoverlay = new MyItemizedOverlay(drawable, this);
	    
	    GeoPoint point = new GeoPoint(lat,lon);
	    OverlayItem overlayitem = new OverlayItem(point, null, location);
	    itemizedoverlay.addOverlay(overlayitem);
	    mc.setCenter(point);
	    mc.zoomToSpan(300000, 300000);
	    mapOverlays.add(itemizedoverlay);
	}
}
